import java.util.ArrayList;
import java.util.List;

public class Student {
    private String studentId;
    private String studentName;
    private String gender;
    private List<Course> selectedCourses = new ArrayList<>(); // 学生选的课程列表

    public Student() {
    }

    public Student(String studentId, String studentName, String gender) {
        this.studentId = studentId;
        this.studentName = studentName;
        this.gender = gender;
    }

    public void selectCourse(Course course) {
        selectedCourses.add(course);
        System.out.println(studentName + " 选了课程：" + course.getCourseName());
    }

    public void dropCourse(Course course) {
        if (selectedCourses.remove(course)) {
            System.out.println(studentName + " 退了课程：" + course.getCourseName());
        } else {
            System.out.println(studentName + " 未选该课程，无法退课");
        }
    }

    public void printCourseSchedule() {
        System.out.println(studentName + " 的课表：");
        for (Course course : selectedCourses) {
            System.out.println(course);
        }
    }

    public String getStudentId() {
        return studentId;
    }

    public void setStudentId(String studentId) {
        this.studentId = studentId;
    }

    public String getStudentName() {
        return studentName;
    }

    public void setStudentName(String studentName) {
        this.studentName = studentName;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public List<Course> getSelectedCourses() {
        return selectedCourses;
    }

    public void setSelectedCourses(List<Course> selectedCourses) {
        this.selectedCourses = selectedCourses;
    }
}